<#assign contextPath=springMacroRequestContext.getContextPath()/>
<#import "/public/frame/main.html" as frame/>
<@frame.head "南航明珠商城-赠品活动"></@frame.head>
<link rel="stylesheet" type="text/css" href="${contextPath}/resources/css/search_table.css" />
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i>后台管理中心<span class="c-gray en">&gt;</span>促销管理<span class="c-gray en">&gt;</span>赠品活动<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
  <div class="text-c">
    <form action="${contextPath}/presentActivityController/query_activity_list" method="post" name="search_form" id="search_form">
      <input type="hidden" name="page" value="${pagination.pageNo}" id="page"/>  
      <table class="table search_table" >
        <tr>  
          <td>活动名称：</td>
          <td>
            <input id="activeName" name="name" class="input-text radius" placeholder="请输入名称" value="${productSaleActiveQo.name}" maxlength="200"/>
          </td>  
          <td>活动类型：</td> 
          <td>              
            <span class="select-box radius">
              <select class="select" id="activeType" name="activeType">
                <option value>请选择</option>
                <option value="4" <#if 4==productSaleActiveQo.activeType>selected="selected"</#if>>买赠活动</option>
                <option value="5" <#if 5==productSaleActiveQo.activeType>selected="selected"</#if>>满赠活动</option>
              </select>
            </span>
          </td>  
          <td>开始时间：</td>
          <td>
            <input type="text" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'endDate\')}',readOnly: true})" id="startDate" 
            value='${(productSaleActiveQo.startDate?string("yyyy-MM-dd"))!}' name="startDate" class="input-text radius Wdate" style="width:45%;">
                                 至
            <input type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'startDate\')}',readOnly: true})" id="endDate" 
            value='${(productSaleActiveQo.endDate?string("yyyy-MM-dd"))!}' name="endDate" class="input-text radius Wdate" style="width:45%;">
          </td>
        </tr>
        <tr>
          <td>活动状态：</td>
          <td>
            <span class="select-box radius">
              <select class="select" id="status" name="status" >
                <option value>全部</option>
                <#list statusMap?keys as key>
                  <option value="${key}" <#if key==productSaleActiveQo.status>selected="selected"</#if>>${statusMap["${key}"]}</option> 
                </#list>
              </select>
            </span>
          </td>
          <td></td>
          <td colspan="3">
            <input class="btn btn-success radius" type="button" onclick="search();" value="搜索"/>
            <input class="btn btn-success radius" type="button" onclick="toIsEmpty();" value="重置"/>
          </td>
        </tr>
      </table>
    </form>
  </div>
  <div class="cl pd-5 bg-1 bk-gray mt-20 radius"> 
    <span class="l">
      <a href="javascript:;" onclick="addActive();" class="btn btn-primary radius">发布活动</a> 
    </span>
    <span class="r">共有数据：<strong>${pagination.totalCount}</strong> 条</span>
  </div>
  <table class="table table-border table-bordered table-bg radius table-hover" style="margin-top: -1px;">
    <thead>
      <tr class="text-c">
        <th style="width: 30%">活动名称</th>
		<th style="width: 15%">开始时间</th>
		<th style="width: 15%">结束时间</th>
		<th style="width: 10%">状态</th>
		<th style="width: 15%">活动类型</th>
		<th style="width: 15%">操作</th>
      </tr>
    </thead>
    <tbody>
      <#list pagination.list as list> 
        <tr class="text-c">
          <td>${list.name}</td>
          <td>${(list.startDate?string("yyyy-MM-dd HH:mm:ss"))!}</td>
          <td>${(list.endDate?string("yyyy-MM-dd HH:mm:ss"))!}</td>
          <td>${statusMap["${list.status}"]}</td>
          <td>${activeTypeMap["${list.activeType}"]}</td>
          <td>
            <!-- 1：待审核；2：审核通过；3：审核驳回；4：已开始；5：已结束；6：已关闭；7：已暂停  -->
			<#if list.status == 1>
			  <a href="javascript:;" onclick="auditActive('${list.id?c}');">审核</a>
			</#if>
            <#if list.status == 4>
			  <a href="javascript:;" onclick="pauseActive('${list.id?c}');">暂停</a>
			</#if>
			<#if list.status == 7>
			  <a href="javascript:;" onclick="startActive('${list.id?c}');">开始</a>
			</#if>
            <#if list.status == 1 || list.status == 2 ||  list.status == 3>
              <a href="javascript:;" onclick="editActive('${list.id?c}');">修改</a>
		    </#if>
		    <#if list.status == 4 || list.status == 7>
		      <a href="javascript:;" onclick="closeActive('${list.id?c}');">关闭</a>
		    </#if>
		    <a href="javascript:;" onclick="deleteActive('${list.id?c}');">删除</a>
		    <a href="javascript:;" onclick="lookActive('${list.id?c}');">查看</a>
		  </td>
        </tr>
      </#list>
    </tbody>
  </table>
  <div id="div_page" style="padding-top: 10px; float: right"></div>
</div>
<@frame.end "default"></@frame.end>
<script type="text/javascript" src="${contextPath}/resources/js/laypage/laypage.js"></script>
<script type="text/javascript" src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/presentActivity/activity_list.js"></script>
<script type="text/javascript">
  var path = "${contextPath}";
  laypage({
    cont: "div_page",// 容器。值支持id名、原生dom对象，jquery对象。
    pages: ${pagination.totalPage},// 通过后台拿到的总页数
    curr:  ${pagination.pageNo} || 1, // 当前页
	skip: true, // 是否开启跳页
	first: 1, // 将首页显示为数字1,。若不显示，设置false即可
	last: ${pagination.totalPage}, // 将尾页显示为总页数。若不显示，设置false即可
    jump: function(obj , first){// 触发分页后的回调
		if(!first){ // 点击跳页触发函数;当前页为obj.curr
            $("#page").val(obj.curr);
            $("#search_form").submit();
		}
    }
  });
</script>